﻿{include file="public/header"}

<title>订单列表</title>
</head>
<style>
    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }

</style>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 统计管理
    <span class="c-gray en">&gt;</span>统计列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<form method="get">
    <div class="ch-c">
        <div>
            <input type="text" name="start_time" id="countTimestart" onfocus="selecttime(1)" size="17"
                   class="date input-text " readonly style="width:100px"
                   value="<?php echo isset($data['start_time'])?$data['start_time']:''?>">
            -
            <input type="text" name="end_time" id="countTimeend" onfocus="selecttime(2)" size="17"
                   class="date input-text" readonly style="width:100px"
                   value="<?php echo isset($data['end_time'])?$data['end_time']:''?>">
            <span class="select-box inline" style="border: none">
            </span>
      <input type="hidden" name="type" value="2">
        </div>
            <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>

        </div>

</form>
<div class="page-container">


    <div class="mt-20">
        <div class="title-border">

            <div class="flex2 ">时间</div>

            <div class="flex2 ">店长</div>
            <div class="flex2 ">响应时长/<span style="color: red">分</span></div>
            <div class="flex2 ">上门及时性/<span style="color: red">分</span></div>
            <!--<div class="flex2 ">报价及时性/<span style="color: red">分</span></div>-->
            <!--<div class="flex2 screen-phone">反馈及时性/<span style="color: red">分</span></div>-->
            <!--<div class="flex2 screen-phone">跟进及时性/<span style="color: red">分</span></div>-->
            {if condition="$type !=1"}
            <div class="flex3 screen-phone">平均签单时间</div>
            {/if}
            <div class="flex2 screen-phone">远程跟进频次</div>
            <div class="flex3 screen-phone">消息及时性/<span style="color: red">分</span></div>
            <div class="flex3 screen-phone">页面停留时长/<span style="color: red">分</span></div>
            <div class="flex3 screen-phone">活跃位置</div>
            <div class="flex2 screen-phone">在线时长</div>
            <div class="flex3 screen-phone">app使用时长统计/<span style="color: red">小时</span></div>
            <div class="flex3 screen-phone">店长上门距离/<span style="color: red">千米</span></div>
            <div class="flex2 ">查看</div>


        </div>
        {volist name='list' id='vo'}
        <div class="content-border">
            {if condition="$type ==3"}
            <div class="flex2 screen-phone">{:date('Y-m-d',$starttime)}</div>
            {elseif condition="$type ==2"}
            <div class="flex2 screen-phone">{:date('Y-m-d',$starttime)}至{:date('Y-m-d',$enttime)}</div>
            {elseif condition="$type ==1"}
            <div class="flex2 screen-phone">{:date('Y-m-d',$starttime)}</div>
            {/if}

            <div class="flex2 ">{$vo.username}</div>
            <div class="flex2 ">{$vo.response}</div>
            <div class="flex2 ">{$vo.home}</div>
            <!--<div class="flex2">{$vo.quote}</div>-->
            <!--<div class="flex2 screen-phone">{$vo.feedback}</div>-->
            <!--<div class="flex2 screen-phone">{$vo.next}</div>-->
            {if condition="$type !=1"}
            <div class="flex3 screen-phone">{$vo.average}</div>
            {/if}
            <div class="flex2 screen-phone">{$vo.remotely}</div>
            <div class="flex3 screen-phone">{$vo.message}</div>
            <div class="flex3 screen-phone">{$vo.page}</div>
            <div class="flex3 screen-phone">{$vo.active}</div>
            <div class="flex2 screen-phone">{$vo.online}</div>
            <div class="flex3 screen-phone">{$vo.app}</div>
            <div class="flex3 screen-phone">{$vo.distance}</div>
            <div class="flex2"><a style="text-decoration:none" class="ch-button ch-wathet cha" data-id="{$vo.user_id}"
                                  data-status="1" href="javascript:;" title="查看位置">查看位置</a>
            </div>


        </div>
        {/volist}
        <div class="pages" style="float: right">{$list->render()}</div>

    </div>
    <div class="ch-more">
        <div class="ch-more-white">
            <div class="ch-more-content">

            </div>
            <div class="ch-more-off"></div>
        </div>
    </div>
</div>

{include file="public/footer"}
<script type="text/javascript">
    $('.chan').bind("click", function () {
        var cha = $(".chan option:selected").val();
        if (cha == 2) {
            $('.shan').remove();
            var html = `
            <div class="shan">
               <input type="text" name="start_time" id="countTimestart" onfocus="selecttime(2)" size="17"
                   class="date input-text " readonly style="width:100px"
                   value="<?php echo isset($data['start_time'])?$data['start_time']:''?>">
            -
            <input type="text" name="end_time" id="countTimeend" onfocus="selecttime(2)" size="17"
                   class="date input-text" readonly style="width:100px"
                   value="<?php echo isset($data['end_time'])?$data['end_time']:''?>">
          `;

            $(".ss").append(html);
        } else {
            $('.shan').remove();
            var html = `
              <div class="shan">
        <input type="text" name="time" id="countTimestart"  size="17" class="date input-text" readonly style="width:100px" onfocus="selecttime(1)"></div>`;
            $(".ss").append(html);
        }
    });



    function selecttime(flag) {
        if (flag == 1) {
            var endTime = $("#countTimeend").val();
            if (endTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: endTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        } else if (flag == 2) {
            var startTime = $("#countTimestart").val();
            if (startTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: startTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        } else {
            WdatePicker({dateFmt: 'yyyy-MM-dd'})
        }
    }

    $('.page-container').on('click', '.cha', function () {
        var src = "{:Url('index/StoreManager/cha')}";
        var id = $(this).attr('data-id');
        $.ajax({
            type: 'POST',
            url: src,
            dataType: 'json',
            data: {user_id: id},
            success: function (data) {
                var res = JSON.parse(data);
                if (res.code == 200) {
                    var src = "{:Url('index/StoreManager/map')}";
                    var index = layer.open({
                        type: 2,
                        fix: false,
                        area: ['20%'],
                        title: '查看',
                        content: src + '?user_id=' + res.data.id
                    });
                    layer.full(index);
                } else {
                    layer.msg(res.msg, {icon: 5, time: 1000});
                }

            },
            error: function (data) {
                console.log(data.msg);
            },
        });

    });

    /**
     * 导出
     */
    function downloadFile() {
        var dom = document.getElementById('ifile');
        dom.src = "{:Url('index/Statistics/download')}";
    }

</script>


</body>
</html>
